Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

725
Visualizações
How to create and use a Room Database in Kotlin [Dagger-Hilt]

This is a self-answered question which I intended to ask earlier as I had rep exposure issues in my project, but ended up fixing it after a couple of hours of research. Instead of staying silent, I thought this might help someone in the future. This tutorial demonstrates how you can create a Room database and use it within an activity/fragment. The example use case given here is querying the size of your database and updating the views in a fragment.

Note: There is some Dagger-Hilt dependency injection in the code that follows, but the same methodology should apply if you're manually doing your own dependency injection. I also expect that you have some basic knowledge of MVVM architecture. You may find useful Java related questions here if you're interested in other ways to do this involving LiveData: resource 1, resource 2; however, the focus is on Kotlin and this solution doesn't require LiveData.

over 4 years ago · Hanz Gallego
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda